From 3fe203774b6f3d1b3384b011e68db960c17928c2 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 3 Nov 2008 18:40:56 +0000 Subject: [PATCH] =?utf8?q?Bug=20558001=20=E2=80=93=20gtk=5Ficon=5Fview=5Fe?= =?utf8?q?nable=5Fmodel=5Fdrag=5F[source|dest]=20problem?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit svn path=/trunk/; revision=21753 --- ChangeLog | 6 ++++++ gtk/gtkiconview.c | 49 +++++++++-------------------------------------- 2 files changed, 15 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index d85ed6971c..a09fc40829 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-11-03 Christian Persch + + Bug 558001 – gtk_icon_view_enable_model_drag_[source|dest] problem + + * gtk/gtkiconview.c: Make gtk_drag_*_add_*_targets() usable with GtkIconView. + 2008-11-02 Matthias Clasen Bug 558929 – gtkstatusicon.c: 'event' is a member of the structure diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index ce7c1ee740..b5157c4e48 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -168,10 +168,7 @@ struct _GtkIconViewPrivate gint press_start_x; gint press_start_y; - GtkTargetList *source_targets; GdkDragAction source_actions; - - GtkTargetList *dest_targets; GdkDragAction dest_actions; GtkTreeRowReference *dest_item; @@ -451,8 +448,6 @@ static gboolean gtk_icon_view_maybe_begin_drag (GtkIconView *icon_ GdkEventMotion *event); static void remove_scroll_timeout (GtkIconView *icon_view); -static void clear_dest_info (GtkIconView *icon_view); -static void clear_source_info (GtkIconView *icon_view); static void adjust_wrap_width (GtkIconView *icon_view, GtkIconViewItem *item); @@ -1032,9 +1027,6 @@ gtk_icon_view_destroy (GtkObject *object) icon_view->priv->vadjustment = NULL; } - clear_dest_info (icon_view); - clear_source_info (icon_view); - GTK_OBJECT_CLASS (gtk_icon_view_parent_class)->destroy (object); } @@ -6153,26 +6145,6 @@ unset_reorderable (GtkIconView *icon_view) } } -static void -clear_source_info (GtkIconView *icon_view) -{ - if (icon_view->priv->source_targets) - gtk_target_list_unref (icon_view->priv->source_targets); - icon_view->priv->source_targets = NULL; - - icon_view->priv->source_set = FALSE; -} - -static void -clear_dest_info (GtkIconView *icon_view) -{ - if (icon_view->priv->dest_targets) - gtk_target_list_unref (icon_view->priv->dest_targets); - icon_view->priv->dest_targets = NULL; - - icon_view->priv->dest_set = FALSE; -} - static void set_source_row (GdkDragContext *context, GtkTreeModel *model, @@ -6381,7 +6353,8 @@ set_destination (GtkIconView *icon_view, return FALSE; /* no longer a drop site */ } - *target = gtk_drag_dest_find_target (widget, context, icon_view->priv->dest_targets); + *target = gtk_drag_dest_find_target (widget, context, + gtk_drag_dest_get_target_list (widget)); if (*target == GDK_NONE) return FALSE; @@ -6501,6 +6474,7 @@ static gboolean gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view, GdkEventMotion *event) { + GtkWidget *widget = GTK_WIDGET (icon_view); GdkDragContext *context; GtkTreePath *path = NULL; gint button; @@ -6547,8 +6521,8 @@ gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view, retval = TRUE; - context = gtk_drag_begin (GTK_WIDGET (icon_view), - icon_view->priv->source_targets, + context = gtk_drag_begin (widget, + gtk_drag_source_get_target_list (widget), icon_view->priv->source_actions, button, (GdkEvent*)event); @@ -6926,11 +6900,9 @@ gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view, { g_return_if_fail (GTK_IS_ICON_VIEW (icon_view)); - gtk_drag_source_set (GTK_WIDGET (icon_view), 0, NULL, 0, actions); + gtk_drag_source_set (GTK_WIDGET (icon_view), 0, targets, n_targets, actions); - clear_source_info (icon_view); icon_view->priv->start_button_mask = start_button_mask; - icon_view->priv->source_targets = gtk_target_list_new (targets, n_targets); icon_view->priv->source_actions = actions; icon_view->priv->source_set = TRUE; @@ -6958,11 +6930,8 @@ gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view, { g_return_if_fail (GTK_IS_ICON_VIEW (icon_view)); - gtk_drag_dest_set (GTK_WIDGET (icon_view), 0, NULL, 0, actions); - - clear_dest_info (icon_view); + gtk_drag_dest_set (GTK_WIDGET (icon_view), 0, targets, n_targets, actions); - icon_view->priv->dest_targets = gtk_target_list_new (targets, n_targets); icon_view->priv->dest_actions = actions; icon_view->priv->dest_set = TRUE; @@ -6986,7 +6955,7 @@ gtk_icon_view_unset_model_drag_source (GtkIconView *icon_view) if (icon_view->priv->source_set) { gtk_drag_source_unset (GTK_WIDGET (icon_view)); - clear_source_info (icon_view); + icon_view->priv->source_set = FALSE; } unset_reorderable (icon_view); @@ -7008,7 +6977,7 @@ gtk_icon_view_unset_model_drag_dest (GtkIconView *icon_view) if (icon_view->priv->dest_set) { gtk_drag_dest_unset (GTK_WIDGET (icon_view)); - clear_dest_info (icon_view); + icon_view->priv->dest_set = FALSE; } unset_reorderable (icon_view); -- 2.30.2